package dfbz.demo.homework5;

public class Player {
    public static void main(String[] args) {
        System.out.println("请选择一个角色："+"法力角色/武力角色");
        Player player=new Player();
        System.out.println("选择角色:武力");
        player.select("武力角色");
        System.out.println("-----------------");
        System.out.println("选择角色:法力");
        player.select("法力角色");


    }
    public FightAble select(String str){
        FightAble fightAble=null;
        if(str.equals("法力角色")){
            fightAble=new Magic();
        }else if(str.equals("武力角色")) {
            fightAble=new Warrior();
        }
        fightAble.commonFight();
        fightAble.specialFight();
        return fightAble;
    }
}
